
import Vue from 'vue'
import App from './App.vue'
import router, { setRouter } from './router'
import store from './store'
import Antd from 'ant-design-vue/es'
import 'ant-design-vue/dist/antd.css';
import '@/style/index.scss'
import config from "@/utils/config";
import vueSeamlessScroll from "vue-seamless-scroll"
import VueParticles from "vue-particles";
import moment from 'moment';
import 'moment/locale/zh-cn';
import YuanSelectVue from "@/components/yuanSelect.vue"
import NumberAnimation from "@/components/NumberAnimation/index.vue"
import { format, toDecimalNoZero, toFen, toYuan, utilCheckPermission } from "@/utils/index"
import * as filters from '@/filter/index'

Vue.component('vue-seamless-scroll', vueSeamlessScroll)
Vue.component('NumberAnimation', NumberAnimation)
Vue.component('YuanSelectVue', YuanSelectVue)
Vue.prototype.$config = config
Vue.prototype.$checkPer = utilCheckPermission
Vue.config.productionTip = false
Vue.prototype.$filterOption = (input: any, option: any) => {
  return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
}

Vue.use(Antd)
Vue.use(VueParticles)

Object.keys(filters).forEach(key => {
  Vue.filter(key, (filters as { [key: string]: Function })[key])
})

moment.locale('zh-cn');

if (process.env.NODE_ENV === 'production') {
  if (window) {
    window.console.log = function () { }
  }
}
Vue.prototype.$toYuan = toYuan
Vue.prototype.$toFen = toFen
Vue.prototype.$format = format
Vue.prototype.$toDecimalNoZero = toDecimalNoZero

setRouter(() => new Vue({
  router,
  store,
  render: h => h(App),
  mounted() {
    document.dispatchEvent(new Event('render-event'))
  }
}).$mount('#app'))
